/*
 ============================================================================
 Name		: GaborFilter.h
 Author	  : Lenka Litvova
 Version	 : 1.0
 Copyright   : Symbian C++ implementantion of GaborFilter class of GaborAPI, 
			   which copyright is: 
			   (c) Copyright 2002-3 Adriaan Tijsseling. All rights reserved.
 Description : Class definition for a single Gabor Filter
 ============================================================================
 */

#ifndef GABORFILTER_H
#define GABORFILTER_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include <s32file.h> //kniznica pre pracu so subormi - potrebna kniznica efsrv.lib
#include <versit.h>
#include <e32debug.h>//iba na debugovanie

// CLASS DECLARATION

/**
 *  CGaborFilter
 * 
 */
class CGaborFilter : public CBase
	{
public:
	// Constructors and destructor

	/**
	 * Destructor.
	 */
	~CGaborFilter();

	/**
	 * Two-phased constructor.
	 */
	static CGaborFilter* NewL(TInt aRadius, TReal32 aAngle, TReal32 aFreq, TReal32 aSigma, TReal32 aPhase);

	/**
	 * Two-phased constructor.
	 */
	static CGaborFilter* NewLC(TInt aRadius, TReal32 aAngle, TReal32 aFreq, TReal32 aSigma, TReal32 aPhase);
	
	/**
	 * Initialization of filter parameters.
	 */
	void Compute();
	
	/**
	 * Load filter parameters and values from file.
	 */
	void LoadFromFileL(const TDesC& aFileName);
	
	/**
	  * Save filter parameters and values to file.
	  */
	void SaveToFileL(const TDesC& aFileName);
		
	
	/**
	 * Getting of the real part of value for the given field.
	 */
	inline TReal32	GetReal( TInt col, TInt row  ) { return iReals->At(row*iSize+col);}//iReals[x][y]; }
	/**
	 * Getting of the imaginery part of value for the given field.
	 */
	inline TReal32 	GetImaginary( TInt  col, TInt row ) { return iReals->At(row*iSize+col);}//iImags[x][y]; }

private:

	/**
	 * Constructor for performing 1st stage construction
	 */
	CGaborFilter();

	/**
	 * EPOC default constructor for performing 2nd stage construction
	 */
	void ConstructL(TInt aRadius, TReal32 aAngle, TReal32 aFreq, TReal32 aSigma, TReal32 aPhase);
		
private:
	TInt	iXYO;			// zaciatok - stred obrazka
	TInt	iSize;		// velkost filtra
	TReal32 iSigma;			// polomer Gaussovej funkcie
	TReal32 iAngle;			// orientacia (theta)
	TReal32 iPhase;			// faza (rho)
	TReal32 iFrequency;		// frekvencia(omega)
	//TReal32** iReals;			//realne casti
	//TReal32** iImags;		// imaginarne casti
	
	CArrayFixFlat<TReal32> *iReals;
	CArrayFixFlat<TReal32> *iImags;

	};

#endif // GABORFILTER_H
